<%@page import="cn.xiu.dang.service.impl.UserServiceImpl"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
  <%--   <base href="<%=basePath%>"> --%>
    <meta charset="UTF-8">
    <title>处理登录表</title>
  </head>
  <body>
    <%
    request.setCharacterEncoding("utf-8");
    String email=request.getParameter("email");
     String pwd=request.getParameter("pwd");
     //创建用户业务对象
     UserServiceImpl usi=new UserServiceImpl();
     //调登录方法获取结果
     int result = usi.login(email, pwd);
     if(result==1){
     request.getRequestDispatcher("../index.jsp").forward(request, response);
    }else if(result==0){
    out.print("<script>alert('密码不正确');location.href='../index.jsp';</script>");
    }else if(result==-1){
    out.print("<script>alert('用户不存在');location.href='../index.jsp';</script>");
    }
     %>
     <h1><%=email %></h1>
  </body>
</html>
